package RMI;

import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;


public class Server {
	static String name = "chat";

	public Server() {}

	
	public static void main(String args[]) {

		try {
			
			RemoteChat obj = new RemoteChat();
			Chat stub = (Chat) UnicastRemoteObject.exportObject(obj, 0);
			
															
			// Bind the remote object's stub in the registry
			Registry registry = LocateRegistry.getRegistry();
			registry.rebind(name, stub);
			
						
			System.err.println("Server ready");
		} catch (Exception e) {
			System.err.println("Server exception: " + e.toString());
			e.printStackTrace();
		}
	}
}